<?php
unset($params);
$params['sid'] = $sid;
$params['action'] = "manageDomains";
$params['from_page'] = "home";
$domainurl = "$baseURL/?".encode_params($params);

if ($res_a['own_domain'] == 't' && $res_a['dns_cluster'] == 'f') {
	$params['start_ajax'][0] = "LoadPage('managednsDomains');";
	$domainurl = "$baseURL/?".encode_params($params);?>
<table class="marketing_tip" width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<th colspan="2" class="marketing_head" align="left">&nbsp;&nbsp;MARKETING TIP</th>
	</tr>
	<tr>
		<td width="50" align="center" bgcolor="fffee8" valign="top"><img src="images/ico_marketing_tip.gif" alt="Marketing Tip" width="36" height="41"></td>
		<td bgcolor="fffee8" valign="top">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<?=translate('dns_tip1');?>
					</td>
					<td width="16">&nbsp;</td>
					<td valign="top">
						<?=translate('dns_tip2');?>
						<p align="center">
						<input name="submit23" type="button" value="START HERE" onclick="window.location.href='<?=$domainurl;?>';">
						</p>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<br>

<?php } elseif ($res_a['own_domain'] == 't' && $res_a['dns_cluster'] == 't') {

//-----------------------------------------------------
$sql['type'] = "SELECT";
$sql['params'] = "rec.name,rec.content";
$sql['table'] = "dns_cluster.records AS rec, dns_cluster.domains AS dom";
$sql['where'] = "dom.reseller_id = '$id' AND dom.id=rec.domain_id";
$sql['options'] = "";
$sql['return'] = "struct";
#$sql['return'] = "query";
//------------------------------------------------------
#exit($res = sql_exec($sql,$dbh81,'assoc'));
if (!$dom_info=sql_exec($sql,$dbh81,'assoc')) {
	exit("Temporary Error!");
}
$name_servers = array();
$mail_servers = array();
foreach ($dom_info as $dom) {
	if (preg_match("/^ns\d|dns\d/",$dom['name'])) {
		$name_servers[$dom['name']] = $dom['content'];
	} elseif (preg_match("/^smtp|imap|pop|mail/",$dom['name'])) {
		$mail_servers[$dom['name']] = $dom['content'];
	}
}

//-----------------------------------------------------
$sql['type'] = "SELECT";
$sql['params'] = "start_date,expire_date";
$sql['table'] = "purchases";
#$sql['where'] = "reseller_id = '$id' AND rp_product_id in (23,24)"; //camio
$sql['where'] = "reseller_id = '$id' AND rp_product_id in (30,31)"; // verdi
$sql['options'] = "";
$sql['return'] = "struct";
#$sql['return'] = "query";
//------------------------------------------------------
#exit($res = sql_exec($sql,$dbh81,'assoc'));
if (!$dates=sql_exec($sql,$dbh81,'assoc')) {
	exit("Temporary Error!");
}
$start_date = $dates[0]['start_date'];
$expire_date = $dates[0]['expire_date'];
/*$mail_servers = array();*/
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td colspan="2">
			<p>
			<?php
			$params['start_ajax'][0] = "LoadPage('managednsDomains');";
			$domainurl = "$baseURL/?".encode_params($params);

			if ($expire_date < date('Y-m-d')) {
				echo "&raquo; Your <a href='$domainurl'>DNS Cluster</a> is <strong class='red'>SUSPENDED</strong> since <strong>$expire_date</strong><br>";
			} else {
				echo "&raquo; Your <a href='$domainurl'>DNS (E-mail Clusters)</a> are <strong style='color:#006600'>ACTIVE</strong> since <strong>$start_date</strong><br>";
			} ?>
			&nbsp;
			</p>
		</td>
	</tr>
	<tr>
		<td width="290" valign="top">
			<strong>Name Servers:</strong><br>
			<?php
			foreach ($name_servers as $name => $server) {
				echo "$name ($server)<br>\n";
			}
			?>
		</td>
		<td valign="top">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td colspan="2">
						<strong>E-mail Server:</strong><br>
						<?php
						if (!empty($mail_servers)) {
							foreach ($mail_servers as $name => $server) {
								echo "$name ($server)<br>\n";
							}
						} else {
							echo "none<br>\n
							<input type='button' value='set one here' onclick='window.location.href=\"$domainurl\";'>";
						}
						?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<br>

<?php } else {
	$params['start_ajax'][0] = "loadPlan('p1');";
	$domainurl = "$baseURL/?".encode_params($params);?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td valign="top">
			<table class='bTable' cellspacing=0 cellpadding=0 width=277>
				<tr>
					<th align="left">&raquo; Private DNS 1</th>
				</tr>
				<tr>
					<td><span style="padding-left:15px;"><img align="absmiddle" src="images/ok.gif" alt="OK" width="14" height="17">&nbsp;&nbsp;
						<strong style="font-size:12px;"><span class="red">1</span> DEDICATED IP &amp; <span class="red">1</span> SHARED IP</strong></span>
						<br><br>
						<div style="background-color:#dcdcdc">&nbsp;<strong>Example:</strong></div>
						<strong>ns1.mydomain.com</strong>
						<em>(uses a Dedicated IP)</em><br>
						<strong>ns2.mydomain.com</strong> <em>(uses a Shared IP)</em><br />
						<br />
						<div style="height:1px; background:url(images/dots_grey_line_01.gif); background-repeat:repeat-x;"></div>
							<table style="border:none;" width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td style="border:none;"><strong>Price:</strong>  <strong style="font-size:18px;">$20.00</strong> <strong>/year</strong></td>
									<td  style="border:none;" align="right"><input type="button" value="&nbsp;SELECT&nbsp;" onclick="window.location.href='<?=$domainurl;?>';"></td>
								</tr>
							</table>
					</td>
				</tr>
			</table>
		</td>
		<td width="10">&nbsp;</td>
		<?php
		$params['start_ajax'][0] = "loadPlan('p2');";
		$domainurl = "$baseURL/?".encode_params($params);
		?>
		<td valign="top">
			<table class='bTable' cellspacing=0 cellpadding=0 width=277>
				<tr>
					<th align="left">&raquo; Private DNS 2 </th>
				</tr>
				<tr>
					<td><span style="padding-left:15px;"><img align="absmiddle" src="images/ok.gif" alt="OK" width="14" height="17">&nbsp;&nbsp;
						<strong style="font-size:12px;"><span class="red">2</span> DEDICATED IPs</strong></span>
						<br>
						<br>
						<div style="background-color:#dcdcdc">&nbsp;<strong>Example:</strong></div>
						<strong>ns1.mydomain.com</strong>
						<em>(uses a Dedicated IP)</em><br>
						<strong>ns2.mydomain.com</strong> <em>(uses a Dedicated IP)</em><br />
						<br />
						<div style="height:1px; background:url(images/dots_grey_line_01.gif); background-repeat:repeat-x;"></div>
							<table style="border:none;" width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td style="border:none;"><strong>Price:</strong>  <strong style="font-size:18px;">$40.00</strong> <strong>/year</strong></td>
									<td  style="border:none;" align="right"><input type="submit" value="&nbsp;SELECT&nbsp;" onclick="window.location.href='<?=$domainurl;?>';"></td>
								</tr>
							</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<?php } ?>